package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DishMapper {
    @AutoFill(value= OperationType.INSERT)
    void insert(Dish dish);
    //菜品分页查询
    Page<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);

    void delete(List<Long> idsList);
    @Select("select * from dish where id=#{id}")
    Dish getById(Long id);

    @AutoFill(value= OperationType.UPDATE)
    void update(Dish dish);

    //根据分类id查询菜品

    List<Dish> list(Long categoryId);
    @Select("select count(id) from dish where status=#{status}")
    Integer countByStatus(int i);
}
